(function ($) {
    $.fn.gotop = function (options) {
        var settings = {
            top:100,
            delay:1500,
            speed:400
        };
        if (options) {
            $.extend(settings, options);
        }
        var self = this;
        $(self).hide();
        //当滚动条的位置处于距顶部100像素以下时，跳转链接出现，否则消失
        $(window).scroll(function () {
            if ($(window).scrollTop() > settings.top) {
                $(self).fadeIn(settings.delay);
            } else {
                $(self).fadeOut(settings.delay);
            }
        });

        $(self).find('.gotop').click(function () {
            $("html,body").animate({
                scrollTop:"0"
            }, settings.speed);
        });
        $(self).find('.sc').click(function () {
            bookmark()
        });
    }
})(jQuery);